int powv[MAXV][25]= {0}; voidinit(){ for (int i = 0; i < V; i ++) powv[i][0] = i * i * i % V; for (int j = 1; j <= 18; j ++) for (int i = 0; i < V; i ++) powv[i][j] = powv[powv[i][j - 1]][j - 1]; } inlineintcalc(int x, int p){ for (int j = 19; j >= 1; j --) if (p & (1 << (j - 1))) x = powv[x][j - 1]; return x + 1; }
int subsum[MAXN]= {0}; inlineintlowbit(int x){ return x & (- x); } voidadd(int x, int delta){ while (x <= N) { subsum[x] += delta; x += lowbit (x); } } intquery(int x){ int cnt = 0; while (x > 0) { cnt += subsum[x]; x -= lowbit (x); } return cnt; }
bitset<12 * MAXV> f;
intgetnum(){ int num = 0; char ch = getchar ();
while (! isdigit (ch)) ch = getchar (); while (isdigit (ch)) num = (num << 3) + (num << 1) + ch - '0', ch = getchar ();
return num; }
intmain(){ N = getnum (), M = getnum (), V = getnum (); for (int i = 1; i <= N; i ++) a[i] = getnum (); init (); for (int q = 1; q <= M; q ++) { int opt = getnum (), l = getnum (), r = getnum (); if (opt == 1) { if (r - l + 1 >= 12) puts ("Yuno"); else { f.reset(); bool suc = false; f[0] = 1; for (int i = l; i <= r; i ++) { int x = calc (a[i], query (i)); if ((f & (f << x)).any()) { suc = true; break; } f = f | (f << x); } suc ? puts ("Yuno") : puts ("Yuki"); } } else add (l, 1), add (r + 1, - 1); }